<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Customers filter form base class.
 *
 * @package    tvpv
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 13459 2008-11-28 14:48:12Z fabien $
 */
class BaseCustomersFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'searchkey'   => new sfWidgetFormFilterInput(),
      'taxid'       => new sfWidgetFormFilterInput(),
      'name'        => new sfWidgetFormFilterInput(),
      'taxcategory' => new sfWidgetFormPropelChoice(array('model' => 'Taxcustcategories', 'add_empty' => true)),
      'card'        => new sfWidgetFormFilterInput(),
      'maxdebt'     => new sfWidgetFormFilterInput(),
      'address'     => new sfWidgetFormFilterInput(),
      'address2'    => new sfWidgetFormFilterInput(),
      'postal'      => new sfWidgetFormFilterInput(),
      'city'        => new sfWidgetFormFilterInput(),
      'region'      => new sfWidgetFormFilterInput(),
      'country'     => new sfWidgetFormFilterInput(),
      'firstname'   => new sfWidgetFormFilterInput(),
      'lastname'    => new sfWidgetFormFilterInput(),
      'email'       => new sfWidgetFormFilterInput(),
      'phone'       => new sfWidgetFormFilterInput(),
      'phone2'      => new sfWidgetFormFilterInput(),
      'fax'         => new sfWidgetFormFilterInput(),
      'notes'       => new sfWidgetFormFilterInput(),
      'visible'     => new sfWidgetFormFilterInput(),
      'curdate'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'curdebt'     => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'searchkey'   => new sfValidatorPass(array('required' => false)),
      'taxid'       => new sfValidatorPass(array('required' => false)),
      'name'        => new sfValidatorPass(array('required' => false)),
      'taxcategory' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Taxcustcategories', 'column' => 'id')),
      'card'        => new sfValidatorPass(array('required' => false)),
      'maxdebt'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'address'     => new sfValidatorPass(array('required' => false)),
      'address2'    => new sfValidatorPass(array('required' => false)),
      'postal'      => new sfValidatorPass(array('required' => false)),
      'city'        => new sfValidatorPass(array('required' => false)),
      'region'      => new sfValidatorPass(array('required' => false)),
      'country'     => new sfValidatorPass(array('required' => false)),
      'firstname'   => new sfValidatorPass(array('required' => false)),
      'lastname'    => new sfValidatorPass(array('required' => false)),
      'email'       => new sfValidatorPass(array('required' => false)),
      'phone'       => new sfValidatorPass(array('required' => false)),
      'phone2'      => new sfValidatorPass(array('required' => false)),
      'fax'         => new sfValidatorPass(array('required' => false)),
      'notes'       => new sfValidatorPass(array('required' => false)),
      'visible'     => new sfValidatorPass(array('required' => false)),
      'curdate'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'curdebt'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('customers_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Customers';
  }

  public function getFields()
  {
    return array(
      'id'          => 'Text',
      'searchkey'   => 'Text',
      'taxid'       => 'Text',
      'name'        => 'Text',
      'taxcategory' => 'ForeignKey',
      'card'        => 'Text',
      'maxdebt'     => 'Number',
      'address'     => 'Text',
      'address2'    => 'Text',
      'postal'      => 'Text',
      'city'        => 'Text',
      'region'      => 'Text',
      'country'     => 'Text',
      'firstname'   => 'Text',
      'lastname'    => 'Text',
      'email'       => 'Text',
      'phone'       => 'Text',
      'phone2'      => 'Text',
      'fax'         => 'Text',
      'notes'       => 'Text',
      'visible'     => 'Text',
      'curdate'     => 'Date',
      'curdebt'     => 'Number',
    );
  }
}
